#ifndef NETCFGAPPLET_H
#define NETCFGAPPLET_H

#include <Plasma/PopupApplet>


class QModelIndex;
class QDBusPendingCallWatcher;

class NetcfgAppletPrivate;

/**
 * @brief Plasma applet, front-end to @c netcfg.
 *
 */

class NetcfgApplet : public Plasma::PopupApplet
{

    Q_OBJECT

    public:

        /**
         * Class constructor, sets default size.
         */
        NetcfgApplet(QObject *parent, const QVariantList &args);

        /**
         * Initializes the applet and its extender.
         */
        void init();

        /**
         * Redraws the applet.
         */
        void paintInterface(QPainter *painter,
            const QStyleOptionGraphicsItem *option,
            const QRect &contentsRect);

    protected:

        /**
         * Initializes the extender content.
         */
        void initExtenderItem(Plasma::ExtenderItem *item);

    private:

        NetcfgAppletPrivate *const d;

    private Q_SLOTS:

        void slotActivated(const QModelIndex &index);

        void slotProfilesUpdate();

        void slotStateUpdate();

        void slotUp();

        void slotDown();

        void slotAllDown();

        /**
         * Run @p netcfg-auto-wireless
         */
        void slotAutoWireless();

        void slotFinished(QDBusPendingCallWatcher *watcher);

};

K_EXPORT_PLASMA_APPLET(netcfgapplet, NetcfgApplet)

#endif
